//
//  AppDelegate.m
//  cyChat
//
//  Created by 楼楚 on 15/11/28.
//  Copyright © 2015年 Chu Lou. All rights reserved.
//

#import "AppDelegate.h"
#import "XMPPFramework.h"
#import "cCNavigationController.h"
#import "DDLog.h"
#import "DDTTYLogger.h"


@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
////    沙盒的路径
//    NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)lastObject];
//    NSLog(@"%@",path);
//
//打开xmpp的日志
    [DDLog addLogger:[DDTTYLogger sharedInstance]];
    
    
//    设置导航栏背景
    [cCNavigationController setupNavTheme];
    
   //从沙盒里加载用户数据到单例
    [[cCUserInfo sharedcCUserInfo]loadUserInfoFromSandbox];
//    判断用户的登录状态 yes直接来到主界面
    if ([cCUserInfo sharedcCUserInfo].loginStatus) {
        
        UIStoryboard *storyboard=[UIStoryboard storyboardWithName:@"Main" bundle:nil];
        self.window.rootViewController = storyboard.instantiateInitialViewController;
    }
    //自动登录服务
    [[cCXMPPTool sharedcCXMPPTool] xmppUserLogin:nil];
    
    return YES;
}
@end
